package com.eastelsoft.smartiot.bssserver.util;

import java.net.HttpURLConnection;

public class HttpResp {
	public static final int CODE_NETWORK_ERROR = -1;
	public static final int CODE_SYSTEM_ERROR = -2;

	private int statusCode = HttpURLConnection.HTTP_OK;
	private String body;

	public HttpResp(int statusCode, String body) {
		this.statusCode = statusCode;
		this.body = body;
	}

	public static HttpResp newNetworkError() {
		return new HttpResp(CODE_NETWORK_ERROR, "网络连接错误");
	}

	public static HttpResp newSystemError() {
		return new HttpResp(CODE_SYSTEM_ERROR, "系统内部错误");
	}

	public int getStatusCode() {
		return statusCode;
	}

	public void setStatusCode(int statusCode) {
		this.statusCode = statusCode;
	}

	public String getBody() {
		return body;
	}

	public void setBody(String body) {
		this.body = body;
	}

}
